package com.itheima.e;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Student> stulist = new ArrayList<>();
        stulist.add(new Student("张三", "男", "20", "88"));
        stulist.add(new Student("李四", "女", "19", "99"));

        try (
                BufferedWriter bw = new BufferedWriter(new FileWriter("E:/student.txt"));
        ) {

            for (Student student : stulist) {
                bw.write(student.getName() + "," + student.getSex() + "," + student.getAge() + "," + student.getScore());
                bw.write("\t\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
